using System;
using System.ComponentModel.DataAnnotations;
// using WorkFlowCore.Workflows; // Will be added if WorkTaskStatus is directly from WorkFlowCore

namespace WorkFlowCore.BusinessDemo.Web.Models
{
    public class OfficialSealApplicationViewModel
    {
        public int Id { get; set; }

        [Required(ErrorMessage = "申请人姓名不能为空")]
        [MaxLength(100)]
        [Display(Name = "申请人姓名")]
        public string ApplicantName { get; set; }

        [Required(ErrorMessage = "申请部门不能为空")]
        [MaxLength(200)]
        [Display(Name = "申请部门")]
        public string ApplicantDepartment { get; set; }

        [Required(ErrorMessage = "申请日期不能为空")]
        [DataType(DataType.Date)]
        [Display(Name = "申请日期")]
        public DateTime ApplicationDate { get; set; } = DateTime.Now.Date;

        [Required(ErrorMessage = "公章类型不能为空")]
        [MaxLength(100)]
        [Display(Name = "公章类型")]
        public string SealType { get; set; }

        [Required(ErrorMessage = "申请事由不能为空")]
        [MaxLength(2000)]
        [DataType(DataType.MultilineText)]
        [Display(Name = "申请事由")]
        public string Reason { get; set; }

        [Required(ErrorMessage = "预计用章开始日期不能为空")]
        [DataType(DataType.Date)]
        [Display(Name = "预计用章开始日期")]
        public DateTime UsageStartDate { get; set; } = DateTime.Now.Date;

        [Required(ErrorMessage = "预计用章结束日期不能为空")]
        [DataType(DataType.Date)]
        [Display(Name = "预计用章结束日期")]
        // TODO: Add validation for UsageEndDate >= UsageStartDate
        public DateTime UsageEndDate { get; set; } = DateTime.Now.Date;

        [Required(ErrorMessage = "数量/次数不能为空")]
        [Range(1, int.MaxValue, ErrorMessage = "数量/次数必须大于0")]
        [Display(Name = "数量/次数")]
        public int Quantity { get; set; } = 1;

        [MaxLength(1000)]
        [Display(Name = "附件信息")]
        public string? AttachedFilesInfo { get; set; }

        public string? WorkTaskId { get; set; }

        [Display(Name = "创建时间")]
        public DateTime CreatedTime { get; set; }

        [Display(Name = "最后更新时间")]
        public DateTime? UpdatedTime { get; set; }

        public string? CreatorUserId { get; set; }

        // Properties for displaying workflow status, to be populated from WorkTaskStateInfoViewModel
        [Display(Name = "流程状态")]
        public string? CurrentWorkTaskStatusDisplay { get; set; }
        public string? CurrentWorkTaskStatus { get; set; } // Raw status, e.g., "Pending", "Processed"
                                                          // Consider using an enum if WorkTaskStatus is available and stable.
                                                          // For now, using string as per WorkTaskStateInfoViewModel.Status
    }
}
